﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using CSharp4ExpressionMetaCompiler;
using SStuff.MetaEffects.Model;

namespace Sample2_CompositeShader.Providers
{
    public class BlackAndWhiteProvider : IColorModifierProvider
    {
        #region IColorModifierProvider Members

        public Expression<Action<ColorOnlyParameter>> GetShaderExpression()
        {
            return o =>
                Block.Declare(new ColorOnlyParameter(), vars =>
                Block.Default
                .Assign(vars.TempColor, new float4((vars.Color.x + vars.Color.y + vars.Color.z) / 3.0f,0.0f,0.0f,0.0f))
                .Assign(vars.Color, new float4(vars.TempColor.xxx, vars.Color.w)));
                
            
        }

        #endregion
    }
}
